package com.ewanghuiju.app.widget.popupwindow;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.ewanghuiju.app.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import razerdp.basepopup.BasePopupWindow;

/**
 * @author sj  qq:751943509
 * @class 服务弹框
 * @time 2020/2/19
 */
public class PintuanFuwuPopup extends BasePopupWindow {


    @BindView(R.id.popup_main)
    LinearLayout popupMain;
    @BindView(R.id.tv_fuwu_text)
    TextView tvFuwuText;

    public PintuanFuwuPopup(Context context) {
        super(context);
        setWidth(getScreenWidth());
        ButterKnife.bind(this, getContentView());
    }

    public void setText(String text) {
        if (tvFuwuText != null) {
            tvFuwuText.setText(text);
        }
    }

    @Override
    public View onCreateContentView() {
        return createPopupById(R.layout.popup_pintuan_fuwu);
    }

    @OnClick({R.id.popup_close, R.id.popup_sure})
    public void doClick(View view) {
        int id = view.getId();
        switch (id) {
            case R.id.popup_close:
                dismiss();
                break;
            case R.id.popup_sure:
                //确定按钮
                dismiss();
                break;
            default:
                break;
        }
    }

//    private static Context adjustAutoSize(Context context) {
//        return new ContextWrapper(context) {
//            private Resources mResources;
//
//            {
//                Resources oldResources = super.getResources();
//                mResources = new Resources(oldResources.getAssets(), oldResources.getDisplayMetrics(), oldResources.getConfiguration());
//            }
//
//            @Override
//            public Resources getResources() {
//                AutoSizeCompat.autoConvertDensityBaseOnWidth(mResources, 720);
//                return mResources;
//            }
//        };
//    }
}
